# Copyright (C) 2022 Google Inc.  # # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_fuchsia//fuchsia:defs.bzl", "fuchsia_cc_binary", "fuchsia_component", "fuchsia_component_manifest", "fuchsia_package", "fuchsia_package_resource")

fuchsia_cc_binary(
    name = "gapii_server",
    srcs = ["gapii_server.cc"],
    sdk_root_label = "@fuchsia_sdk",
    deps = [
        "@fuchsia_sdk//pkg/async-loop-cpp",
        "@fuchsia_sdk//pkg/async-loop-default",
        "@fuchsia_sdk//pkg/vfs_cpp",
    ],
)

fuchsia_component_manifest(
    name = "manifest",
    src = "gapii-server.cml",
)

fuchsia_component(
    name = "gapii-server",
    manifest = ":manifest",
    deps = [
        ":gapii_server",
        ":libgapii",
    ],
)

fuchsia_package_resource(
    name = "libgapii",
    src = "//gapii/cc:libgapii",
    dest = "lib/libgapii.so",
)

fuchsia_package_resource(
    name = "gpu_inspector_json",
    src = "//gapii/vulkan/vk_graphics_spy/fuchsia:fuchsia_json",
    dest = "data/vulkan/explicit_layer.d/GpuInspectorLayer.json",
)

fuchsia_package(
    name = "gapii",
    components = [
        ":gapii-server",
    ],
    resources = [
        ":gpu_inspector_json",
    ],
)
